package com.example.oauth2.config.oauth2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @description： WEBMVC配置
 * @author: xuwenqian
 * @date: 2020/4/15 15:20
 */
@Configuration
public class InterceptorConfiguration implements WebMvcConfigurer {

    @Autowired
    private Oauth2Interceptor oauth2Interceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(oauth2Interceptor)
                // 排除指定连接不做拦截
                .excludePathPatterns("/swagger-resources/**",
                        "/webjars/**",
                        "/swagger-ui.html/**",
                        "/docs",
                        "/login",
                        "/oauth/**");
    }
}
